// 配置
var id = {
    table: 'sys_log_data_table',
}
var sys_log_data = {
    query:[
        {code:1, type:'text', field:'key', title:'关键字', placeholder:'请输入关键字查询'}
    ],
    table: {
        id: id.table,
        url: api.system.log.data,
        cols:[
            {field: 'dataId', title: '数据id'},
            {field: 'user', title: '操作账号', templet: function (obj) {
                    if((typeof obj.user) != "undefined"){
                        return obj.user.loginName;
                    }else{
                        return "";
                    }
                }},
            {field: 'method', title: '请求类型'},
            {field: 'url', title: '请求地址'},
            {field: 'time', title: '请求耗时ms'},
            {field: 'ip', title: '客户端ip'},
            {field: 'createTime', title: '请求时间',templet: function(obj){
                    return soda.convert.timestamp2time(obj.createTime);
                }},
        ],
        toolbar: page_auth.top(),
        bar: function(bar){
            switch (bar.event) {
                case 'search':
                    table.reload(id.table, {
                        page: {
                            curr: 1
                        },
                        where: soda.search.form()
                    });
                    break;
            }
        },
        info:{
            height: '600px',
            data: [
                {field: 'dataId', title: '数据id'},
                {field: 'method', title: '请求类型'},
                {field: 'url', title: '请求地址'},
                {field: 'ip', title: '客户端ip'},
                {field: 'user', title: '操作账号', templet: function (obj) {
                        if((typeof obj) != "undefined"){
                            return obj.loginName;
                        }else{
                            return "";
                        }
                    }},
                {field: 'createTime', title: '请求时间',templet: function(obj){
                        return soda.convert.timestamp2time(obj);
                    }},
                {field: 'message', title: '消息'},
                {field: 'data', title: '响应值'},
            ]
        }
    }
}

// 初始化
initialize({
    title: '数据日志',
    init: function () {
        soda.search.init(sys_log_data.query);
        soda.table.render(sys_log_data.table, true);
    }
})
